<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<script >
var basePath = '<%=basePath%>';
function settab_zzjsnet(name,cursel,n){
	 for(i=1;i<=n;i++){
	  var menu=document.getElementById(name+i);
	  var zzjs=document.getElementById("zzjs_"+name+"_"+i);
	  menu.className=i==cursel?"hover":"";
	  zzjs.style.display=i==cursel?"block":"none";
	 }
}

      function isEmails(email){
          var  emailRegex = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
		  if(!emailRegex.test(email))
		  {
		     return false;
		  }
         return true;
      }
      /**验证邮箱**/
var isEmail=false;
       function checkMail(me){
	       var email=document.getElementById("email").value;
	       if(email!='' && !isEmails(email)){
                document.getElementById("mailid").innerHTML = "* 电子邮箱格式不正确";
                document.getElementById("tip").innerHTML = "";
                isEmail=false;
                return false;
            }else{
	             var url = basePath+'member/checkEmailIsExistMember.action?email='+email;
				 $.get(url,function(mes){
					if(mes=="0"){
		            		document.getElementById("mailid").innerHTML = "* 该电子邮箱已经存在";
                			document.getElementById("tip").innerHTML = "";
		            	    alert("请重新输入电子邮箱!");
		            	    isEmail=false;
		                    return false;
		            	  }else{
		            		 document.getElementById("mailid").innerHTML="";
                			 document.getElementById("tip").innerHTML = "* 写真实的邮箱，注册完成将对所填邮箱进行验证，便于找回密码，请谨慎填写!";
		            	     isEmail=true;
		            	 }
				})
            }
         }
         
/**验证手机号**/
var isPhone=false;
       function checkPhone(me){
	       var phone=document.getElementById("phone").value;
	         var phoneRegex = /1([0-9]){10}/
			  if(phone!='' && !phoneRegex.test(phone.trim())){
                document.getElementById("mailidP").innerHTML = "* 手机号格式不正确";
                document.getElementById("tipP").innerHTML = "";
                isPhone=false;
                return false;
            }else{
	             var url = basePath+'member/checkPhoneIsExistMember.action?phone='+phone;
				 $.get(url,function(mes){
					if(mes=="0"){
		            		document.getElementById("mailidP").innerHTML = "* 该手机号已经存在";
                			document.getElementById("tipP").innerHTML = "";
		            	    alert("该手机号已经存在，请重新输入手机号!");
		            	    isPhone=false;
		                    return false;
		            	  }else{
		            		 document.getElementById("mailidP").innerHTML="* ";
                			 document.getElementById("tipP").innerHTML = "";
		            	     isPhone=true;
		            	 }
				})
            }
         }
/**验证身份证号**/
var isIdcard=false;
       function checkIdcard(me){
	       var idcard=document.getElementById("idcard").value;
			  if(idcard!='' && !CheckCardValue(idcard.trim())){
                document.getElementById("mailidI").innerHTML = "* 身份证格式不正确";
                document.getElementById("tipI").innerHTML = "";
                isIdcard=false;
                return false;
            }else{
	             var url = basePath+'member/checkIdcardIsExistMember.action?idcard='+idcard;
				 $.get(url,function(mes){
					if(mes=="0"){
		            		document.getElementById("mailidI").innerHTML = "* 该身份证已经存在";
                			document.getElementById("tipI").innerHTML = "";
		            	    alert("该身份证已经存在，请重新输入身份证号!");
		            	    isIdcard=false;
		                    return false;
		            	  }else{
		            		 document.getElementById("mailidI").innerHTML="* ";
                			 document.getElementById("tipI").innerHTML = "";
		            	     isIdcard=true;
		            	 }
				})
            }
         }
//验证提交
function checkSubmit1(){
 
 var  email =$("#email");
  if(email.val().trim().length==0)
  {
     alert("请输入邮箱!");
     email.focus();
     return;
  }
   var  password = $("#password");
   if(password.val().trim().length==0)
  {
     alert("请输入密码!");
     password.focus();
     return;
  }
  var  newpass = $("#newpass");
  if(newpass.val().trim().length==0)
  {
     alert("请再次输入密码!");
     newpass.focus();
     return;
  }
  if(!(password.val().trim()==newpass.val().trim()))
  {
     alert("输入的密码，两次密码不一致!");
     newpass.focus();
     return;
  }
   var  realName = $("#realName");
  if(realName.val().trim().length==0)
  {
     alert("请输入真实姓名!");
     realName.focus();
     return;
  }
if("" != realName.val()){
	if(!checkName(realName.val())){
		alert("真实姓名只能为汉字");
		realName.focus();
		return false;
	}
}
  if(realName.val().trim().length<2)
  {
     alert("真实姓名输入至少输入两个字");
     realName.focus();
     return;
  }
  var  phone = $("#phone");
  if(phone.val().trim().length==0)
  {
     alert("请输入手机号码!");
     phone.focus();
     return;
  }
  var phoneRegex = /1([0-9]){10}/
  if(!phoneRegex.test(phone.val().trim()))
  {
       alert("手机号码输入格式错误!");
       phone.focus();
       return;
  }
   var  idcard = $("#idcard");
  if(idcard.val().trim().length==0)
  {
     alert("请输入身份证!");
     idcard.focus();
     return;
  }
  var checkcodeRegex = /(^\d{15}$)|(^\d{17}(\d|X)$)/;
  if(!CheckCardValue(idcard.val().trim()))
  {
       idcard.focus();
       return;
  }
  var  code = $("#code");
  if(code.val().trim().length==0)
  {
     alert("请输入验证码!");
     code.focus();
     return;
  }
    $.ajax({
     type:'post',
     url:'../../member/checkCode.action?code='+code.val(),
     success:function(msg)
     {
         var a=eval('('+msg+')');
         if(!a['result'])
         {
            alert('验证码输入错误!')
         }else{
	        if(isEmail){
	        	if(isPhone){
	        		if(isIdcard){
 						document.forms[0].submit();
 						
 					}else{
	 					alert("请重新输入身份证号");
	 					$("#idcard").focus();
	 				}
 				}else{
	 				alert("请重新输入手机号");
	 				$("#phone").focus();
	 			}
 			}else{
 				alert("请重新输入电子邮箱");
 				$("#email").focus();
            }
         }
        
     }
  
  });

 
}


function checkName(value)//验证只能是中文
	{    
       var s=/^[\u4e00-\u9fa5]+$/; 
       if(value.search(s)==-1)
       {
           return false;
       }       
       return true;
	}

</script>
<html>
	<head>
		<title>用户注册</title>
		<meta http-equiv="pragma" content="no-cache"/>
		<meta http-equiv="cache-control" content="no-cache"/>
		<meta http-equiv="expires" content="0"/>
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
		<meta http-equiv="description" content="This is my page"/>
		<link href="../../resources/css/register.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../../scripts/jquery-1.4.2.js">	</script>
		<script type="text/javascript" src="register.js">	</script>
		
	
	</head>

	<body>
		<form action="../../member/registerMember1.action" method="post">
			<div class="logset">
				<a href="../login/login.jsp">会员登录</a>
				<a href="#">新用户注册</a>
			</div>
			<div class="content">
				<a href="<%=basePath%>">
					<img src="../../resources/images/web/findCipher_03.png" width="213" height="111" />
				</a>
			</div>
			<div class="fc-wr" align="center">
				<div class="title">
					<span class="iml"><img src="../../resources/images/web/findCipher_09.png" alt=""
							width="4" height="33" />
					</span><span style="margin-right: 730px">&nbsp;&nbsp;注册新用户</span><span
						style="font-size: 12px; font-weight: 100;">我已经注册，现在就<a
						href="../login/login.jsp">登录</a>
					</span><span class="imr"><img src="../../resources/images/web/findCipher_12.png"
							width="4" height="33" />
					</span>
				</div>
				<div class="cont" style="height:840px;">

					<div class="fot" align="left">
						<img src="../../resources/images/web/register_03.jpg" width="157" height="24" />
					</div>
					<div class="item" style="margin-bottom: 0px;">
						<span class="label">电子邮箱：</span>
						<span class="input1"><input type="text" id="email" name="tmMember.email" onchange="return checkMail(this)"/>
						</span>
						<span class="ps" id="tip">* 写真实的邮箱，注册完成将对所填邮箱进行验证，便于找回密码，请谨慎填写!</span><font> <span id="mailid" style="color:red"></span></font>
					</div>
					<div class="item"  style="margin-top: 30px;">
						<span class="label">密&nbsp;&nbsp;&nbsp;码&nbsp;：</span>
						<span class="input1"> <input type="password" id="password"  maxlength="10" name="tsSysuser.password"/>
						</span>
						<span class="ps">*</span>
					</div>
					<div class="item">
						<span class="label">再次输入：</span>
						<span class="input1"><input type="password" id="newpass"  maxlength="10"/>
						</span>
						<span class="ps">*</span>
					</div>
					<div class="item">
						<span class="label">真实姓名：</span>
						<span class="input1"><input type="text" id="realName" maxlength="5" name="tmMember.realName" />
						</span>
						<span class="ps">*</span>
					</div>
					<div class="item">
						<span class="label">&nbsp;&nbsp;&nbsp;&nbsp;性别：</span>
						<span style="input1" >
						<select name="tmMember.sex" style="width:120px;">
						  <option selected="selected" value="1">男</option>
						  <option value="2">女</option>
						</select>
						
						</span>
						<span class="ps">*</span>
					</div>
					<div class="item">
						<span class="label">手机号码：</span>
						<span class="input1"> <input type="text" id="phone" maxlength="11" name="tmMember.phone"  onchange="return checkPhone(this)"/>
						</span>
						<span class="ps" id="tipP">*</span><font> <span id="mailidP" style="color:red"></span></font>
					</div>
					<div class="item">
						<span class="label">所在城市：</span>
						<span class="input1"> <select name="" id="proce" class="select" onchange="loadCity();">
							</select>
						</span>
						<span class="input1"> <select name="tmMember.districtId" id="city" class="select">
						</select>
						</span>
						<span class="ps">*</span>
					</div>
					<div class="item">
						<span class="label">身份证号：</span>
						<span class="input1"><input type="text" id="idcard"  maxlength="18" name="tmMember.idcard" onchange="return checkIdcard(this)"/>
						</span>
						<span class="ps" id="tipI">*</span><font> <span id="mailidI" style="color:red"></span></font>
					</div>
					<div class="item">
						<span class="label">验 证 码：</span>

						<span class="input2"> <input type="text"  id="code" maxlength="4" />
						</span>
						<span><img id="img" src="yanzhengma.jsp" width="65" height="26" />
						</span>
						<span>&nbsp;看不清？</span><span><a href="javascript:loadCode()">换一张</a>
						</span>
					</div>
					<div class="item">
						<div class="lable">
							<input name="" type="checkbox"  id="read" checked="checked" />
							<strong>我已阅读并同意&nbsp;</strong><a href="<%=basePath%>aboutus/show.action?id=4" target="_black" style="color: #F00"><strong>网站条款*</strong>
							</a>
						</div>
						<input type="button" class="btn-img" style="cursor:pointer"    onclick="checkSubmit1()" value="同意以下协议，提交" />
					</div>

				</div>



			</div>


			<div class="foot">
			<p>
					<a onclick="this.style.behavior='url(#default#homepage)';this.setHomePage(window.location.href);" href="javascript:;">把网站设为主页</a> &nbsp;&nbsp;&nbsp;
					<a href="javascript:window.external.addFavorite(window.location.href,'医生在线');">把网站添加到收藏夹</a>
				</p>
				<p>
					<a href="<%=basePath%>aboutus/show.action?id=1">关于我们</a> |
					<a href="<%=basePath%>aboutus/show.action?id=1">About US</a>
				</p>
				<p>
					<a href="#">&copy;2012 备案号：京ICP证xxxxxxx号</a>
				</p>
			</div>
		</form>
	</body>
	<script >
		$.get(basePath+'member/readAboutus.action',function(mes){
			$("#xy").val(mes);
		});
	</script>
</html>
